package com.yhyvr.console.controller;

import com.alibaba.fastjson.JSON;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.StringUtil;
import com.yhyvr.console.annotation.RepeatSubmit;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.lz.kit.LogKit;
import com.lz.tool.LzStringUtils;
import com.yhyvr.pojo.resp.console.BootStrapGridResp;
import com.yhyvr.console.model.login.LoginUserModel;
import com.lz.mybatis.jdbc.auto.dao.BoOrderLogMapper;
import com.lz.mybatis.jdbc.auto.model.BoOrderLog;
import com.lz.mybatis.jdbc.auto.model.BoOrderLogExample;
import com.yhyvr.pojo.resp.CommonResp;
import com.yhyvr.pojo.resp.HttpResult;
import com.yhyvr.pojo.req.console.BootStrapGridReq;
import com.yhyvr.console.controller.ControllerQueryTool;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * title:
 * </p>
 * <p>
 * description:
 * </p>
 *
 * @create 张钦
 * @update
 * @version 1.0
 * @date
 */
@Controller
public class BoOrderLogController{
	@Resource
	private BoOrderLogMapper modelMapper;


	@RequestMapping("/console/bo_order_log/list")
	public String list(){
		return "console/boOrderLog/boOrderLog_table";
	}

	@RequestMapping("/console/bo_order_log/json")
	public @ResponseBody BootStrapGridResp json(BootStrapGridReq bootGridReq){
		Page page = PageHelper.offsetPage(bootGridReq.getOffset(), bootGridReq.getLimit());
    	if(bootGridReq.getSort()!=null) {
    		page.setOrderBy("order_id desc,create_time desc");
    	}
		BoOrderLogExample boOrderLogExample = new BoOrderLogExample();
        ControllerQueryTool.setBoOrderLogCriteria(bootGridReq.getQuery(),boOrderLogExample.createCriteria());
		List<BoOrderLog> boOrderLogList = modelMapper.selectByExample(boOrderLogExample);
		return new BootStrapGridResp(page.getTotal(),boOrderLogList);
	}

}
